<!DOCTYPE html>
<html >
<head >
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta charset="utf-8"/>
    <title>WEBPLUS快速开发框架</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css"  media="all"/>
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all"/>
   <link rel="stylesheet"  href="../../../css/common/loader.css" media="all"/>
   <link rel="stylesheet"  href="../../../css/common/tablepage.css" media="all"/>
</head>
<body>
	<div class="layui-fluid">
		<div class="layui-card">
			<div class="layui-form layui-card-header layuiadmin-card-header-auto" id="searchForm">
			   <div class="layui-form-item">
<div class="layui-inline">
						<label class="layui-form-label">日志内容</label>
						<div class="layui-input-block">
							<input type="text"  style="width:120px;" name="content" 
								autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">操作用户</label>
						<div class="layui-input-block">
							<input type="text"  style="width:120px;" name="userName" 
								autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">日志类型</label>
						<div class="layui-input-block">
							<select name="logType" lay-select-dict="log_type">
								
							</select>
						</div>
					</div>
					<div class="layui-inline">
						<label class="layui-form-label">操作日期</label>
						<div class="layui-input-block">
							<input style="width:180px;" name="operateDate" type="text" class="layui-input" id="operateDate">
						</div>
					</div>
				 <div class="layui-inline">
				  <button class="layui-btn layuiadmin-btn-sm" lay-submit
							lay-filter="searchSubmit"  >查询</button>
				</div>
				</div>
			</div>
			<div class="layui-card-body">
				<table id="dataList" lay-filter="dataList" ></table>
				
	
			</div>
		</div>
	</div>
<div type="text/html" id="trTool" style="display:none">
    <a  data-grant="system:log:edit" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
</div>

<div type="text/html" id="toolbar" style="display:none" >
<div class="layui-btn-container">
 <button  data-grant="system:log:remove" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="remove"> <i class="layui-icon layui-icon-delete"></i>删除日志</button>
<button data-grant="system:log:clear" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="clear"> <i class="layui-icon layui-icon-delete"></i>清空日志</button>
</div>
</div>
<script   src="../../../layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="../../../lib/jQuery-2.2.0.min.js" ></script>
	<script>
		layui.config({
			base :  '../../../layuiadmin/' //静态资源所在路径
		}).extend({
			webplus : 'lib/webplus'//主入口模块
			
		}).use([ 'table','form','webplus','laydate' ], function() {
			var $ = layui.$,
			webplus=layui.webplus,
			form = layui.form,
			 laydate = layui.laydate,
			table = layui.table;
			laydate.render({
	            elem: '#operateDate'
	            , range: true
	        });
		   var cols= [ [ {
				type : 'numbers',
				title : '序号'
			}, {
				checkbox : true
			} , {
				field : 'logId',
				title : '编号',
				hide : true 
			}, {
				field : 'content',
				title : '日志内容',
				width : 150
			},{
				field : 'logType_dict',
				title : '日志类型',
				width : 90
			},{
				field : 'method',
				title : '请求方法',
				width : 200
			},{
				field : 'params',
				title : '请求参数',
				minWidth : 180
			},{
				field : 'ip',
				title : '请求ip',
				width : 100
			}, {
				field : 'responseTime',
				title : '响应时间',
				width : 90
			}, {
				field : 'userName',
				title : '操作用户',
				width : 140
			},{
				field : 'createTime',
				title : '操作时间',
				width : 180
			}] ];
		   webplus.init('system/log/list',cols)
			 //监听行工具事件
			  table.on('tool(dataList)', function(rowObj){
			    switch(rowObj.event){
			    	case 'edit':
			    		webplus.openEditWindow('editLog.html','编辑',rowObj,'logId','','700','560');
			       		
			   			break;
			    	case 'remove':
				    	
				        webplus.removeRow('system/log/remove',rowObj,'logId');
			    		break;
			    }
			  });
			 //监听表头按钮事件
			  table.on('toolbar(dataList)', function(obj){
			    switch(obj.event){
			      	case 'add':
				         //打开添加弹出框
				         webplus.openWindow('addLog.html','新增','700','560');
			     	     break;
			      	case 'remove':
			      		 webplus.batchRemoveRow('system/log/batchRemove','','logId');
			      		 break;
			      	case 'clear':
			      		webplus.doAjax('system/log/clearLog', {}, '你确认清空所有日志吗？','','0')
			      		 break;
			      		
			    }
			  });

		});
	</script>

</body>
</html>